/********************************************************************
	Created:	2011/02/22    9:52 
	Filename: 	EventListener.h
	Author:		falconwang
*********************************************************************/

#ifndef EventListener_h__
#define EventListener_h__

#include "Event.h"
#include "Core/inc/CountPtr.h"

namespace ES
{
	class   EventListener;
	typedef Core::CountPtr<EventListener> EL_Ptr;

	class EventListener
	{
	public:
		EventListener() : m_bDestroy(false) {}  

		virtual ~EventListener() {}

		virtual void operator() (Event& _e) {};
		bool operator == (const EventListener& _other) { return Compare(_other) ; }

		void		 Destroy() { m_bDestroy = true; }
		bool		 IsDestroy() const { return m_bDestroy; }

	public:

		enum Status
		{
			EL_NEW = 0,
			EL_NORMAL,
			EL_DIE,
		};

	protected:

		virtual bool Compare(const EventListener& _other) = 0 ;

		bool		m_bDestroy;  // TODO : remove this, use status. 

		Status		m_eStatus;
	};
}
#endif // EventListener_h__